package js;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class q杨辉 {

    // 生成杨辉三角的第 N 行
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextInt();
        long index = findIndex(N);
        System.out.println(index);
    }

    private static long findIndex(long N) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        int maxCol = Integer.MAX_VALUE;
        if (N == 1) {
            return 1;
        }
        long m = 3;  // 从第三行开始
        while(true) {
            List<Integer> nextRow = new ArrayList<>();
            nextRow.add(1);  // 每一行开头都是1
            for (int i = 1; i <= m/2 && i < maxCol; i++) {
                if(m % 2 == 1 && i == m/2) {  // 奇数行且走到中间
                    nextRow.add(list.get(i-1)*2);
                }else if(m % 2 == 0 && i == m/2){ // 偶数行走到中间，手动折掉 ,避免list（前一行）越界

                }else {
                    nextRow.add(list.get(i) + list.get(i - 1));
                }
                if(nextRow.get(nextRow.size()-1) > N) {
                    maxCol = i;
                    break;
                }
                if(nextRow.get(nextRow.size()-1) == N) {
                    return m*(m-1) / 2 + nextRow.size();
                }
                if(m>5  && i >2){
                    if(nextRow.get(2)>N){
                        return N*(N-1) / 2 + 2;
                    }
                }
            }

            m++;
            list = nextRow;
        }

    }
}
